#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
int main()
{
	int a;
	for (a = 101; a >= 101 && a <= 1000; a=a + 2)
	{
		int j = 2;
		int k = 1;
		for (j = 2; j <= a - 1; j++)
		{
			if (a % j == 0)
			{
				k = 0;
				break;
			}
		}
		if (k == 1)
		{
			int n=0, m;
			m = a;
			while (m != 0)
			{
				n = n * 10 + m % 10;
				m /= 10;
			}
			if (n == a)
				printf("%d\t", a);
		}
	}
	return 0;
}